const createValidator = (func: (any) => boolean, message: string) => ({
  validator: func,
  message: (props: any) => `${props.value} is not a valid ${message}!`,
});

// 是否为正整数
function isPositiveInt(val: number): boolean {
  return Number.isInteger(val) && val >= 0;
}

export default createValidator(isPositiveInt, '2');
